const xrFrameSystem = wx.getXrFrameSystem();

function createVideoTsbsEffect(scene) {
	return scene.createEffect({
		"name": "video-tsbs",
		"images": [{
			"key": "u_baseColorMap",
			"default": "white",
			"macro": "WX_USE_BASECOLORMAP"
		}],
		"defaultRenderQueue": 3000,
		"passes": [{
			"renderStates": {
				"cullOn": false,
        "blendOn": true,
				"depthWrite": true,
				"cullFace": 2
			},
			"lightMode": "ForwardBase",
			"useMaterialRenderStates": true,
			"shaders": [0, 1]
		}],
		"shaders": [
			`#version 100
  precision highp float;
  attribute vec3 a_position;
  attribute vec2 a_texCoord;
  
  uniform mat4 u_projection;
  uniform mat4 u_world;
  uniform mat4 u_view;
  varying highp vec2 vTextureCoord;
  
  void main()
  {
    vTextureCoord = a_texCoord;
    gl_Position = u_projection * u_view * u_world * vec4(a_position,1.0);
  }`,
			`#version 100
  precision highp float;
  uniform sampler2D u_baseColorMap;
  varying highp vec2 vTextureCoord;
  void main()
  {
    vec4 color = texture2D(u_baseColorMap, vec2(vTextureCoord.x*0.5 + 0.5,vTextureCoord.y));
    vec4 colora = texture2D(u_baseColorMap, vec2(vTextureCoord.x*0.5 + 0.5,vTextureCoord.y));
  gl_FragData[0] = vec4(color.xyz,colora.x);
  }  
    `
		]
	})
}
xrFrameSystem.registerEffect("video-tsbs", createVideoTsbsEffect);